const path = require("path");
// const fs = require("fs");

module.exports = {
  publicPath: "./",
  outputDir: "dist",
  assetsDir: "assets",
  lintOnSave: false,
  runtimeCompiler: true,
  transpileDependencies: [],
  productionSourceMap: false,


  chainWebpack: config => {
    // webpack链接API，用于生成和修改webapck配置，https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
    config.resolve.alias
      .set('@', path.join(__dirname, 'src'))
      .set('@core-router', path.join(__dirname, 'src/core/router'))
      .set('@views', path.join(__dirname, 'src/views'))
      .set('@components-layout', path.join(__dirname, 'src/components/layout'))
      .set('@components-basic', path.join(__dirname, 'src/components/basic'))
      .set('@router', path.join(__dirname, 'src/router'))
      .set('@images', path.join(__dirname, 'src/assets/images'))
      .set('@api', path.join(__dirname, 'src/api'))

  },

  devServer: {
    open: false,
    port: 80,
    public: require('os').networkInterfaces()[Object.keys(require('os').networkInterfaces())[0]][1].address + ':'+ 80,
    https: false,
    hotOnly: false,
    proxy: {
      // 配置跨域
      "/api": {
        target: 'http://jobtrain.test.dc-it.cn',
        ws: true,
        changOrigin: true
        /*
          pathRewrite: {
              '^/api': ''
          }
          */
      }
    }
  },

  configureWebpack: {
    resolve: {
      extensions: [".js", ".vue", ".json"]
    }
  },

  css: {
	requireModuleExtension: true,
	sourceMap: true,
    loaderOptions: {
      sass: {
        //data: fs.readFileSync('src/style/global.scss', 'utf-8')
        data: `
        @import "@/style/global.scss";`,
		sassOptions: {
		  javascriptEnabled: true,
		  modifyVars: {
		    'vab-color-blue': '#1890ff',
		    'vab-margin': '20px',
		    'vab-padding': '20px',
		    'vab-header-height': '65px',
		  },
		},
      }
    }
  }
};